package com.ruoyi.dataserver.api.dto;

import com.ruoyi.dataserver.api.entity.StatisticsData;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * @ProjectName
 * @Package com.lab.dataserver.api.dto
 * @ClassName StatisticDataDto
 * @Description 统计返回对象数据封装
 * @Company lab
 * @Author heff
 * @Date 2020/7/10 14:25
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */

@Data
public class StatisticDataDto implements Serializable {

  private int totalCount = 0;
  @Setter(AccessLevel.NONE)
  private double totalLength = Double.valueOf(0);
  private List<StatisticsData> statisticsDataList;

  public void setTotalLength(Double totalLength) {
    double temp = Double.valueOf(0);
    if(totalLength != null && !totalLength.equals(temp)){
      temp = Double.parseDouble(String.format("%.2f", totalLength));
    }
    this.totalLength = temp;
  }
}
